const {
    test_test2
} = require('./.logic');
let c = 0
const topo = test_test2.create({
    name: 'topo',
    "methods": {
        "Step1": function (arg, info) {
            console.log('Step1>>', arg);
            return (arg + 1)
        },
        "Step2": function (arg, info) {
            console.log('Step2>>', arg);
            return (arg + 1)
        },
        "condition": function (arg, info) {
            c++;
            if (c > 10) {
                return 'Yes'
            }
            return 'No'
        }
    }
})
topo.$onAfterEach(function ({
    from,
    to,
    id,
    args
}) {
    console.log(id, 'onAfterEach>>', from, to, args);
})
setInterval(function () {
    console.log(topo.$commit('Step1', 1, 2))
}, 1000)
const pro = new Promise((resolve, reject) => {
    setTimeout(() => {
        resolve(1)
    }, 1000)
})
const pro2 = pro.then(res => {
    return 123
}).then(res => {
    console.log(res, '??????')
    return new Promise((resolve, reject) => {
        setTimeout(() => {
            resolve(456)
        },2000)
    })
}).then(res => {
    console.log(res, '??????2')
    return 789
})
console.log(pro2)